package com.jt.www.enums.endorse;

/**
 * 身份
 */
public enum StudentTeacherEnum {
    STUDENT("学生", 1),
    TEACHER("教师", 2);

    private String msg;
    private byte code;

    StudentTeacherEnum(String msg, int code) {
        this.msg = msg;
        this.code = (byte) code;
    }

    public static byte getCodeByMsg(String msg) {
        for (StudentTeacherEnum studentTeacherEnum : StudentTeacherEnum.values()) {
            if (studentTeacherEnum.msg.equals(msg)) {
                return studentTeacherEnum.getCode();
            }
        }
        return 1;
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }

    public byte getCode() {
        return code;
    }

    public void setCode(byte code) {
        this.code = code;
    }
}
